package edu.xust.MetadataGenerator.domain;

import java.io.Serializable;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;

import com.google.gson.annotations.Expose;

public class MetaData implements Serializable{
	private static final long serialVersionUID = 6632567610435451363L;
	public static final String CONSOLE = "console";
	public static final String METADATA = "MetaData";
	public static final String TABLES = "Tables";
	public static final String TABLE = "Table";
	
	public static final String FIELDS = "Fields";
	public static final String FIELD = "Field";
	public static final String FIELDCONSTRAINTS = "FieldConstraints";
	public static final String FIELDCONSTRAINT = "FieldConstraint";
	public static final String FIELDVALIDATORS = "FieldValidators";
	public static final String FIELDVALIDATOR = "FieldValidator";
	public static final String FIELDVALIDATORPARAMS = "FieldValidatorParams";
	public static final String FIELDVALIDATORPARAM = "FieldValidatorParam";
	public static final String TABLECONSTRAINTS = "TableConstraints";
	public static final String TABLECONSTRAINT = "TableConstraint";
	
	public static final String APIS = "apis";
	public static final String API = "API";
	public static final String APIPARAMS = "apiParams";
	public static final String APIPARAM = "APIParam";
	public static final String APIVALIDATORS = "ApiValidators";
	public static final String APIVALIDATOR = "APIValidator";
	public static final String APIVALIDATORPARAMS = "APIValidatorParams";
	public static final String APIVALIDATORPARAM = "APIValidatorParam";

	@Expose
	private String groupid;

	@Expose
	private String artifactid;

	@Expose
	private String artifactid_en;

	@Expose
	private String artifactid_en_abbr;

	@Expose
	private String copyright;

	@Expose
	private String author;

	@Expose
	private String version;

	@Expose
	private String database;

	@Expose
	private String date;
	
	@Expose
	private String tableSpace;
	
	@Expose
	private String tablePrefix;
	
	@Expose
	private List<Table> tables;
	
	@Expose
	private String sourceRoot;
	
	@Expose
	private String outputRoot;

	@Expose
	private String model;

	@Expose
	private String encoding;
	
	public MetaData(){
		SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
		Calendar calendar = Calendar.getInstance();
		date = format.format(calendar.getTime());
		groupid = "com.xust";
		artifactid = "test";
		artifactid_en = "test";
		artifactid_en_abbr = "test";
		copyright = calendar.get(Calendar.YEAR) + " 西安科技大学计算机学院";
		author = "张建华";
		version = "1.0";
		database = "oracle";
		sourceRoot = "template";
		outputRoot = "output";
		model = "test.tdd";
		encoding = "utf-8";
		
		tables = new LinkedList<Table>();
	}

	public String getGroupid() {
		return groupid;
	}
	public void setGroupid(String groupid) {
		this.groupid = groupid.replace(" ", "");
	}
	public String getCopyright() {
		return copyright;
	}
	public void setCopyright(String coyright) {
		this.copyright = coyright;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author.replace(" ", "");
	}
	public String getVersion() {
		return version;
	}
	public void setVersion(String version) {
		this.version = version.replace(" ", "");
	}
	public String getDatabase() {
		return database;
	}
	public void setDatabase(String database) {
		this.database = database.replace(" ", "");
	}
	public String getDate() {
		return date;
	}
	public void setDate(String date) {
		this.date = date;
	}
	public List<Table> getTalbes() {
		return tables;
	}
	public void setTalbes(List<Table> talbes) {
		this.tables = talbes;
	}
	@Override
	public String toString() {
		// TODO Auto-generated method stub
		return METADATA;
	}
	public String getArtifactid() {
		return artifactid;
	}
	public void setArtifactid(String artifactid) {
		this.artifactid = artifactid;
	}

	public List<Table> getTables() {
		return tables;
	}

	public void setTables(List<Table> tables) {
		this.tables = tables;
	}

	public String getTableSpace() {
		return tableSpace;
	}

	public void setTableSpace(String tableSpace) {
		this.tableSpace = tableSpace.replace(" ", "");
	}

	public String getTablePrefix() {
		return tablePrefix;
	}

	public void setTablePrefix(String tablePrefix) {
		this.tablePrefix = tablePrefix.replace(" ", "");
	}

	public String getSourceRoot() {
		return sourceRoot;
	}

	public void setSourceRoot(String sourceRoot) {
		this.sourceRoot = sourceRoot;
	}

	public String getOutputRoot() {
		return outputRoot;
	}

	public void setOutputRoot(String outputRoot) {
		this.outputRoot = outputRoot;
	}

	public String getModel() {
		return model;
	}

	public void setModel(String model) {
		this.model = model;
	}

	public String getArtifactid_en() {
		return artifactid_en;
	}

	public void setArtifactid_en(String artifactid_en) {
		this.artifactid_en = artifactid_en;
	}

	public String getArtifactid_en_abbr() {
		return artifactid_en_abbr;
	}

	public void setArtifactid_en_abbr(String artifactid_en_abbr) {
		this.artifactid_en_abbr = artifactid_en_abbr;
	}

	public String getEncoding() {
		return encoding;
	}

	public void setEncoding(String encoding) {
		this.encoding = encoding;
	}
}
